package com.example.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.domain.Dish;
import com.example.dto.DishDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper extends BaseMapper<Dish> {
    @Select("SELECT dish.id AS id,dish.name AS NAME,dish.category_id AS categoryId,dish.price AS price,\n" +
            "dish.code AS CODE,dish.image AS image,dish.description AS description,dish.status AS STATUS,dish.sort AS sort,dish.is_deleted AS isDeleted,\n" +
            "dish.create_time AS createTime,dish.update_time AS updateTime,dish.create_user AS createUser,dish.update_user AS updateUser,\n" +
            "category.name AS categoryName\n" +
            "FROM dish,category WHERE dish.category_id=category.id")
    IPage<DishDto> getDishDtoPage(IPage<DishDto> iPage, LambdaQueryWrapper<Dish> queryWrapper);

}
